import React from 'react'
// 路由懒加载 / 加载异步组件
const Home = React.lazy(() => import('../views/home'))
const Layout = React.lazy(() => import('../views/layout'))
const About = React.lazy(() => import('../views/about'))
const Login = React.lazy(() => import('../views/login'))
const Set = React.lazy(() => import('../views/set'))
const Table = React.lazy(() => import('../views/table'))


// 封装路由表
export interface IRoute {
	path: string
	element: React.FC
	children?: IRoute[]
	title?: string
}

export type RouteType = IRoute[]

export const childrenRoutes: RouteType = [{
	path: '/',
	element: Home,
	title: '首页'
}, {
	path: '/table',
	element: Table,
	title: '表格管理'
}, {
	path: '/set',
	element: Set,
	title: '设置'
}, {
	path: '/about',
	element: About,
	title: '关于'
}]


export const routes: RouteType = [{
	path: '/login',
	element: Login
}, {
	path: '/',
	element: Layout,
	children: childrenRoutes
}]

